#!/bin/sh

set -eu

USER="redis"
GROUP="$USER"
CONFFILE="@MEMO_PREFIX@/etc/redis/sentinel.conf"

if [ "$1" = "configure" ]
then
	if ! @MEMO_PREFIX@@MEMO_SUB_PREFIX@/bin/dpkg-statoverride --list ${CONFFILE} >/dev/null 2>&1
	then
		@MEMO_PREFIX@@MEMO_SUB_PREFIX@/bin/dpkg-statoverride --update --add ${USER} ${GROUP} 640 ${CONFFILE}
	fi
fi

#DEBHELPER#

if [ "$1" = "configure" ]
then
	@MEMO_PREFIX@@MEMO_SUB_PREFIX@/bin/@GNU_PREFIX@find @MEMO_PREFIX@/etc/redis -maxdepth 1 -type d -name 'redis-sentinel.*.d' -empty -delete
fi

exit 0
